<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加</title>
    <#assign base=request.contextPath  />
    <base id="base" href="${base}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, adminUser-scalable=0">
    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <script>
        var base =  "${base}";
    </script>
</head>
<body>
<br>
<form class="layui-form " action="">
         <input type="hidden" id="id" name="id" value="${returnDateNo.id!}" >
          <div class="layui-form-item">
              <label class="layui-form-label">归还人</label>
              <div class="layui-input-block">
                  <input type="text" id="userId" name="userId" value="${returnDateNo.userId!}"  autocomplete="off" placeholder="请输入归还人"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">归还批次号</label>
              <div class="layui-input-block">
                  <input type="text" id="returnOddNumber" name="returnOddNumber" value="${returnDateNo.returnOddNumber!}"  autocomplete="off" placeholder="请输入归还批次号"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">归还单位</label>
              <div class="layui-input-block">
                  <input type="text" id="unitId" name="unitId" value="${returnDateNo.unitId!}"  autocomplete="off" placeholder="请输入归还单位"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">归还状态  1 待归还 /2归还成功 /3归还失败</label>
              <div class="layui-input-block">
                  <input type="text" id="returnState" name="returnState" value="${returnDateNo.returnState!}"  autocomplete="off" placeholder="请输入归还状态  1 待归还 /2归还成功 /3归还失败"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">归还时间</label>
              <div class="layui-input-block">
                  <input type="text" id="createTime" name="createTime" value="${returnDateNo.createTime!}"  autocomplete="off" placeholder="请输入归还时间"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">修改时间</label>
              <div class="layui-input-block">
                  <input type="text" id="updateTime" name="updateTime" value="${returnDateNo.updateTime!}"  autocomplete="off" placeholder="请输入修改时间"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">归还失败</label>
              <div class="layui-input-block">
                  <input type="text" id="returnForFailure" name="returnForFailure" value="${returnDateNo.returnForFailure!}"  autocomplete="off" placeholder="请输入归还失败"
                         class="layui-input">
              </div>
          </div>

    <div align="center">
        <button type="button" class="layui-btn" id="submit">保存</button>
    </div>
</form>

<script src="${base}/static/win10/component/layui/layui.js?t=1"></script>
<script src="${base}/static/win10/js/jquery-1.8.3.min.js?t=1"></script>
<script>
    layui.use(['form', 'layer'], function() {
        var form = layui.form
                , layer = layui.layer;
        $("#submit").on("click",function () {
            if(check()===false){
                return;
            }

            var formDate = {
                         id:$("#id").val(),
                         userId:$("#userId").val(),
                         returnOddNumber:$("#returnOddNumber").val(),
                         unitId:$("#unitId").val(),
                         returnState:$("#returnState").val(),
                         createTime:$("#createTime").val(),
                         updateTime:$("#updateTime").val(),
                           returnForFailure:$("#returnForFailure").val()
            }
            $.ajax({
                type: "POST",
                url: base+"/api/returnDateNo/admin/editReturnDateNo",
                data: formDate,
                success: function (data) {
                    layer.msg(data.message)
                    if (data.code === 200) {
                        window.location.href=base+"/api/returnDateNo/admin/main.html"
                    } else {

                    }
                }
            });
        })







        function check(){
                   if($("#userId").val().length<1){
                       layer.msg("请输入归还人");
                       return false;
                   }
                   if($("#returnOddNumber").val().length<1){
                       layer.msg("请输入归还批次号");
                       return false;
                   }
                   if($("#unitId").val().length<1){
                       layer.msg("请输入归还单位");
                       return false;
                   }
                   if($("#returnState").val().length<1){
                       layer.msg("请输入归还状态  1 待归还 /2归还成功 /3归还失败");
                       return false;
                   }
                   if($("#createTime").val().length<1){
                       layer.msg("请输入归还时间");
                       return false;
                   }
                   if($("#updateTime").val().length<1){
                       layer.msg("请输入修改时间");
                       return false;
                   }
                   if($("#returnForFailure").val().length<1){
                       layer.msg("请输入归还失败");
                       return false;
                   }
        }
    });

</script>
</body>
</html>